import {
  post,
  get,
  put,
  dalete,
  postJosn,
  putone,
  patch,
  patchJson,
  daleteJson,
} from '../utils/request';
let host = '';
// if(process.env.NODE_ENV==='development'){
//   host='http://10.51.4.84:18080';
// }
// if(process.env.NODE_ENV==='development'){
//   host='http://10.51.2.149:18080';
// }
const EarlyWarning = host + '/api/tour-service/v1/warn';
const Attendance = '/api/tour-service/v1/attendanceInfo';
const BaseCenter = host + '/api/tour-service/v1/orgManager';
const StoreInspectionTaskSetting = host + '/api/tour-service/v1/patrol';
const getStrors = host + '/api/tour-service/v1/orgManager';
//检查项ＡＰＩ
const checkItemApi = host + '/api/tour-service/v1/checkItemInfo';
//考勤记录API
const attendanceInfo = host + '/api/tour-service/v1/attendanceInfo';
//酒柜识别
const GrandevinInfo = host + '/api/tour-service/v1/GrandevinInfo';
const queryEmpInfoApi = host + '/api/tour-service/v1/EmpFaceCheck';
const deviceManage = host + '/api/tour-service/v1/deviceManage';

import axios from 'axios';
import qs from 'qs';

export function getWarningData(data) {
  return post(`${EarlyWarning}/queryWarnInfoList`, data);
}
export function getWarningDataDetail(data) {
  return post(`${EarlyWarning}/queryWarnInfo`, data);
}
export function getWarningDataDetailOptions(data) {
  return postJosn(`${EarlyWarning}/queryShopOwner`, qs.stringify(data));
}
export function postMessageByDeskWarning(data) {
  return post(`${EarlyWarning}/addTask`, data);
}
export function getBaseCenterData(data) {
  return post(`${BaseCenter}/queryRelational`, data);
}
export function setStoreInspectionTaskSettingState(data) {
  return post(`${StoreInspectionTaskSetting}/openOrClosePatrol`, data);
}
export function getStores(data) {
  return post(`${getStrors}/queryOrganizationById`, data);
}
export function addStoreInspectionTaskSetting(data) {
  return post(`${StoreInspectionTaskSetting}/addPatrol`, data);
}

export function editStoreInspectionTaskSetting(data) {
  return post(`${StoreInspectionTaskSetting}/updatePatrol`, data);
}
export function getStoreTaskTrackingData(data) {
  return post(`${StoreInspectionTaskSetting}/queryTaskTrackList`, data);
}

//业务经理查询
export function getBaseCenterManage(data) {
  return get(`${BaseCenter}/queryManagerList?${qs.stringify(data)}`);
}
export function getBaseCenterMangerList(data) {
  return get(`${BaseCenter}/queryManagerListByUpOrg?${qs.stringify(data)}`);
}

export function getStoreInspectionTaskSettingData(data) {
  return post(`${StoreInspectionTaskSetting}/queryPatrolList`, data);
}
//检查项查询List
export function getCheckItem(data) {
  return post(`${checkItemApi}/getCheckItem`, data);
}
//新增檢查項
export function addCheckItem(data) {
  return post(`${checkItemApi}/addCheckItem`, data);
}
//更新检查项信息
export function changeCheckItem(data) {
  return post(`${checkItemApi}/changeCheckItem`, data);
}
//删除对应检查项
export function deleteCheckItem(data) {
  return post(`${checkItemApi}/deleteCheckItem?${qs.stringify(data)}`);
}
//业务逻辑List
export function getBussTypeList(data) {
  return get(`${checkItemApi}/getBussTypeList`, data);
}
//考勤记录List
export function getAttendanceData(data) {
  return post(`${attendanceInfo}/queryByOrgSeq`, data);
}
//考勤记录统计
export function attendanceStatistics(data) {
  return post(`${attendanceInfo}/attendanceStatistics`, data);
}
//用户指定日期打卡记录
export function getAttendanceByUser(data) {
  return post(`${attendanceInfo}/getAttendanceByUser`, data);
}
//考勤记录详情
export function getAttendanceDataDetail(data) {
  return get(
    `${attendanceInfo}/quertAttendanceDetail?empUuid=${data.empUuid}&currtDate=${data.currtDate}`
  );
}

export function getTaskInfoDetail(data) {
  return post(`${StoreInspectionTaskSetting}/queryTaskInfo`, data);
}
//获取酒柜新照
export function getNewPhotoByDesk(data) {
  return post(`${EarlyWarning}/snap`, data);
}
//查询员工信息
export function queryEmpInfoData(data) {
  return post(`${queryEmpInfoApi}/queryEmpInfo`, data);
}
//新增或修改人脸定妆照信息
export function addOrUpdateEmpInfo(data) {
  return post(`${queryEmpInfoApi}/addOrUpdateEmpInfo`, data);
}
//查看人脸定妆照信息
export function queryEmpInfoDetail(data) {
  return get(`${queryEmpInfoApi}/queryEmpInfoDetail?${qs.stringify(data)}`);
}
//查询酒柜定妆照信息(分页)
export function queryGradevinInfo(data) {
  return post(`${GrandevinInfo}/queryGradevinInfo`, data);
}
//添加酒柜定妆照信息
export function insertGradevinInfo(data) {
  return post(`${GrandevinInfo}/insertGradevinInfo`, data);
}
//更新酒柜定妆照信息
export function changeGradeInfo(data) {
  return post(`${GrandevinInfo}/changeGradeInfo`, data);
}
//根据酒柜uuid删除酒柜信定妆照信息
export function delGardInfoByUuid(data) {
  return post(`${GrandevinInfo}/delGardInfoByUuid?${qs.stringify(data)}`);
}
//获取酒柜可用设备
export function getDeviceInfoList(data) {
  return get(`${deviceManage}/getDeviceInfoList?${qs.stringify(data)}`);
}
//大区工装预警处理
export function verifyWarnInfo(data) {
  return post(`${EarlyWarning}/verifyWarnInfo`, data);
}
//大区陈列预警处理
export function addTask(data) {
  return post(`${EarlyWarning}/addTask`, data);
}
//店长陈列预警处理
export function submitTaskDealInfo(data) {
  return post(`${EarlyWarning}/submitTaskDealInfo`, data);
}
//新增预警对象设置
export function addOrgManager(data) {
  return post(`${BaseCenter}/addOrgManager`, data);
}
//预警对象门店查询
export function queryOrgAndBaseNoRelation(data) {
  return get(`${BaseCenter}/queryOrgAndBaseNoRelation?${qs.stringify(data)}`);
}
//删除门店预警
export function deleteOrgManager(data) {
  return post(`${BaseCenter}/deleteOrgManager`, data);
}
export function queryOrgChildById(data) {
  return get(
    `${StoreInspectionTaskSetting}/queryOrgChildById?${qs.stringify(data)}`
  );
}
export function realDelPatrol(data) {
  return post(`${StoreInspectionTaskSetting}/realDelPatrol`, data);
}
